using AutoMapper;
using Pay.DTO;
using Pay.Data;
using Pay.IService;

namespace Pay.Service.AutoMapper
{
    public class MerchIntroduceMapper : IStartupDto
    {
        private IMapperConfigurationExpression _cfg;
        public MerchIntroduceMapper(IMapperConfigurationExpression cfg)
        {
            _cfg = cfg;
        }
        public void Execute()
        {
            Create();
        }
        protected virtual void Create()
        {
            _cfg.CreateMap<MerchIntroduce, merch_introduce_dto>()
                .ForMember(dest => dest.id, src => src.MapFrom(c => c.Id))
                .ForMember(dest => dest.merch_name, src => src.MapFrom(c => c.MerchName))
                .ForMember(dest => dest.logo_url, src => src.MapFrom(c => c.LogoUrl))
                .ForMember(dest => dest.detail, src => src.MapFrom(c => c.Detail))
                .ForMember(dest => dest.soup_value, src => src.MapFrom(c => c.SoupValue))
                .ForMember(dest => dest.create_time, src => src.MapFrom(c => c.CreateTime))
                .ForMember(dest => dest.status, src => src.MapFrom(c => c.Status))
                .ForMember(dest => dest.is_recommend, src => src.MapFrom(c => c.IsRecommend))
                .ForMember(dest => dest.click_num, src => src.MapFrom(c => c.ClickNum))
                .ForMember(dest => dest.get_num, src => src.MapFrom(c => c.GetNum));
            _cfg.CreateMap<MerchIntroduce,merch_dto>()
               .ForMember(dest => dest.id, src => src.MapFrom(c => c.Id))
               .ForMember(dest => dest.merch_name, src => src.MapFrom(c => c.MerchName))
               .ForMember(dest => dest.logo_url, src => src.MapFrom(c => c.LogoUrl));
            _cfg.CreateMap<MerchIntroduce, merch_detail_dto>()
            .ForMember(dest => dest.id, src => src.MapFrom(c => c.Id))
            .ForMember(dest => dest.merch_name, src => src.MapFrom(c => c.MerchName))
                  .ForMember(dest => dest.soup_value, src => src.MapFrom(c => c.SoupValue))
                   .ForMember(dest => dest.detail, src => src.MapFrom(c => c.Detail))
            .ForMember(dest => dest.logo_url, src => src.MapFrom(c => c.LogoUrl));
            _cfg.CreateMap<merch_introduce_dto, MerchIntroduce>()
                .ForMember(dest => dest.Id, src => src.MapFrom(c => c.id))
                .ForMember(dest => dest.MerchName, src => src.MapFrom(c => c.merch_name))
                .ForMember(dest => dest.LogoUrl, src => src.MapFrom(c => c.logo_url))
                .ForMember(dest => dest.Detail, src => src.MapFrom(c => c.detail))
                .ForMember(dest => dest.SoupValue, src => src.MapFrom(c => c.soup_value))
                .ForMember(dest => dest.CreateTime, src => src.MapFrom(c => c.create_time))
                .ForMember(dest => dest.Status, src => src.MapFrom(c => c.status))
                .ForMember(dest => dest.IsRecommend, src => src.MapFrom(c => c.is_recommend))
                .ForMember(dest => dest.ClickNum, src => src.MapFrom(c => c.click_num))
                .ForMember(dest => dest.GetNum, src => src.MapFrom(c => c.get_num))

                ;

        }
    }
}
